﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TransformSyncCtrl : MonoBehaviour
{
    [SerializeField, Header("如果自定义ID，在这里填写ID，唯一ID")]
    string ID;
    #region Editor
#if UNITY_EDITOR
    private void Reset()
    {
        ID = GetHashCode().ToString();
    }
#endif
    #endregion Editor
    public bool active = true;
    public bool scale = true;
    [Header("如果场景中没有相机同步脚本，以下即使为true也不会同步！并且仅从Server同步至Client")]
    public bool position = false;
    public bool rotation = false;
    // Use this for initialization
    void Start()
    {
        TransformSyncManager.AddTransformSyncCtrl(this, ID);
    }
    public void SetID(string id)
    {
        ID = id;
        TransformSyncManager.AddTransformSyncCtrl(this, ID);
    }
    private void OnDestroy()
    {
        TransformSyncManager.RemoveTransformSyncCtrl(this);
    }
}
